# **********************OBJ INFO**************************
# Author:YuKalix
# @Time    : 2019-9-20 21:53
# @Site    : 52ziyu.cn
# @File    : Camera.py
# @software: PyCharm
# *********************************************************

from picamera import PiCamera
import time


class Camera:
    def __init__(self):
        self.camera = PiCamera()
        # 捕获分辨率
        self.camera.resolution = (1920, 1080)
        # 帧率
        self.camera.framerate = 60

        self.camera.start_preview()

    def main(self):
        self.camera.start_preview()
        # 摄像头预热2秒
        time.sleep(5)
        self.camera.capture('obj.jpg')
        # 一定要关闭
        self.camera.stop_preview()
        self.camera.close()



if __name__ == '__main__':
    S = Camera()
    S.main()
